package com.hb0730.boot.admin.modules.sci.util;

import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.HashMap;

@Component
public class TypeTableUtil {

    // 静态初始化映射关系
    private static final Map<String, String> typeTableMap = new HashMap<>();

    // 静态初始化块，类加载时只会执行一次
    static {
        typeTableMap.put("PaperConf", "sci_paper_conference");
        typeTableMap.put("PaperJour", "sci_paper_journal");
        typeTableMap.put("AcaCom", "sci_academic_communicate");
        typeTableMap.put("AcaDes", "sci_academic_designation");
        typeTableMap.put("AchCov", "sci_achievement_conversion");
        typeTableMap.put("AchSet", "sci_achievement_setup");
        typeTableMap.put("HorApp", "sci_horizontal_approval");
        typeTableMap.put("HorFin", "sci_horizontal_finish");
        typeTableMap.put("VerApp", "sci_vertical_approval");
        typeTableMap.put("VerFin", "sci_vertical_finish");
        typeTableMap.put("WorkLearn", "sci_work_learning");
        typeTableMap.put("IntPat", "sci_intell_patent");
        typeTableMap.put("IntSoft", "sci_intell_software");
        typeTableMap.put("ManPlat", "sci_management_platform");
        typeTableMap.put("ManTeam", "sci_management_team");
        typeTableMap.put("SchAward", "sci_scholarship_award");
        typeTableMap.put("SchShow", "sci_scholarship_show");
        typeTableMap.put("SchSport", "sci_scholarship_sport");
        // 可以继续添加其他映射
    }

    /**
     * 根据类型获取对应的表名
     *
     * @param type 类型名称
     * @return 对应的表名，如果找不到返回 null
     */
    public static String getTableName(String type) {
        return typeTableMap.get(type);
    }
}
